﻿using System;
using System.Web.UI;
using System.Web.Mvc;
using System.Web.Mvc.Html;

namespace Frogism.Web{
    public static class HtmlHelperExtension
    {
public static String NavigationItem(this System.Web.Mvc.HtmlHelper htmlHelper,
                                    String actionLink,
                                    String controller,
                                    String itemTitle)
{
   
    var htmlTemplate = htmlHelper.ActionLink(itemTitle, actionLink, controller) + "</li>";
    var action = htmlHelper.ViewContext.RouteData.Values["action"];
 
    if(actionLink.Equals(action.ToString()))
    {
        htmlTemplate = "<li class=\"active\">" + htmlTemplate;
    }
    else
    {
        htmlTemplate = "<li>" + htmlTemplate;
    }
 
    var result = String.Format(htmlTemplate, actionLink, itemTitle);
    return result;
}
 

    }
}
